//
//  DemoViewController.m
//  xBooks
//
//  Created by wicresoft on 6/23/11.
//  Copyright 2011 wicresoft. All rights reserved.
//

#import "DemoViewController.h"
#import "ExamplesViewController.h"
#import "PageViewController.h"

@implementation DemoViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [pageController release];
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    UIViewController *rootViewController = [[[ExamplesViewController alloc] init] autorelease];
    leaveController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
    leaveController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    
    pageController = [[PageViewController alloc] init];
    pageController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

-(IBAction)leaveAction
{
    [self presentModalViewController:leaveController animated:YES];
}

-(IBAction)pageAction
{
    [self presentModalViewController:pageController animated:YES];
}

@end
